/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.awt.Point;
import java.util.ArrayList;

/**
 *
 * @author Morten
 */
public class Knight extends ChessPiece1{
    
    private Point position;

    public Knight(String name, boolean color, Point position) {
	super(name, color, position);
	this.position = position;
    }

    @Override
    public ArrayList<Point> possibleMoves() {
	ArrayList<Point> possibleMoves;
	possibleMoves = new ArrayList<>();
	for (int i = 0; i < 9; i++) {
	    for (int j = 0; i < 9; j++) {
		if (i != position.getX() || j != position.getY()) {
		    if((Math.sqrt(Math.pow(i-position.getX(),2))/Math.sqrt(Math.pow(j-position.getY(),2)))==2||(Math.sqrt(Math.pow(i-position.getX(),2))/Math.sqrt(Math.pow(j-position.getY(),2)))==0.5){
			if(canMoveTo(i, j)){
			    possibleMoves.add(new Point(i, j));
			}
		    }
		}

	    }

	}
	return possibleMoves;
    }

}
